﻿using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using Ue.Infrastructure.Web.UI;
using Ue.Qcdz.Domain.Adver;

namespace Ue.Qcdz.UI.Controls.Adver
{
    public class AdvertRepetView : SkinnedGridView
    {
        private string skinFileName = "~/Themes/zh-cn/Skins/AdvertImgView.ascx";
        #region Overrides of SkinnedControl

        public string WebSiteName { get; set; }
        public string PageName { get; set; }
        public string DivId { get; set; }
        protected override string GetSkinFileName()
        {
            return skinFileName;
        }

        #endregion

        #region Overrides of SkinnedGridView

        protected override void GridViewDataBind(object sender, EventArgs args)
        {
            IAdvertisementRepository userRepository = Ue.Infrastructure.RepositoryFramework.RepositoryFactory.GetRepository<IAdvertisementRepository, Domain.Adver.Advertisement>();
            IList<Domain.Adver.Advertisement> listAdv = userRepository.Find(WebSiteName,PageName,DivId);
            Repeater repeater = sender as Repeater;
            repeater.DataSource = listAdv;
            repeater.DataBind();
            this.RecordCount = listAdv.Count;
        }

        #endregion
    }
}
